# Contributor: lauren n. liberda <lauren@selfisekai.rocks>
# Maintainer: lauren n. liberda <lauren@selfisekai.rocks>
pkgname=simdutf
pkgver=5.6.0
pkgrel=0
pkgdesc="Unicode validation and transcoding at billions of characters per second"
url="https://simdutf.github.io/simdutf/"
arch="all"
makedepends="
	cmake
	samurai
	"
license="Apache-2.0 OR MIT"
subpackages="
	$pkgname-dev
	$pkgname-doc
	fastbase64
	sutf
	"
source="https://github.com/simdutf/simdutf/archive/v$pkgver/simdutf-$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None \
		$crossopts
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -Dm644 LICENSE-MIT -t "$pkgdir"/usr/share/licenses/$pkgname/
}

doc() {
	amove usr/share/licenses
}

fastbase64() {
	amove usr/bin/fastbase64
}

sutf() {
	amove usr/bin/sutf
}

sha512sums="
57748cadd07a265e7297408f20ab7a7e899f8676972027b09b168464f7b68de82790a6877bfad8197501be95a754b18458be4c36740bafb7e0a32630c7bd1d2d  simdutf-5.6.0.tar.gz
"
